package org.jeecg.modules.article.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

/**
 * TODO:
 *
 * @author Zhang Hao yu
 * @date 2020/12/1 16:20
 */
@Data
public class RotationVO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**主键*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;

    /**图片*/
    @Excel(name = "图片", width = 15)
    private transient java.lang.String articleImageString;

    private byte[] articleImage;

    public byte[] getArticleImage(){
        if(articleImageString==null){
            return null;
        }
        try {
            return articleImageString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getArticleImageString(){
        if(articleImage==null || articleImage.length==0){
            return "";
        }
        try {
            return new String(articleImage,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
}